
/******************************************************************************\
|    Title:        	 TABLEE1: Summary Statistics By Year				       |
|    Date:         	 July 2023	                                         	   |
|    Author:         Elisa Wirsching	      							       |
\******************************************************************************/


clear all
set more off, permanently
numlabel, add
set maxvar 32000


use congress_yearly.dta, clear

* generate percentage change in annual pay
sort stafferid year
bysort stafferid: gen percentchange_dannualpay = abs((adjdaily_annualpay[_n]-adjdaily_annualpay[_n-1])/adjdaily_annualpay[_n-1])*100 if year[_n]==year[_n-1]+1

collapse (mean) adjannual_pay percentchange_dannualpay last=lastyear lobby=lobbydirectafter touncovered = switchtouncovered_treatment (count) n=daysworked, by(year)

* display percentages btw 1-100
foreach var in last lobby touncovered {
	replace `var'=`var'*100
}

order year n adjannual_pay percentchange_dannualpay touncovered last lobby 

export excel summarystats_year, firstrow(variables) replace